/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0084ff;
    --secondary-color: #f0f2f5;
    --text-primary: #050505;
    --text-secondary: #65676b;
    --border-color: #e4e6eb;
    --success-color: #42b72a;
    --hover-color: #f2f2f2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--secondary-color);
    height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
}

/* 聊天容器 */
.chat-container {
    max-width: 1400px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 20px;
    height: calc(100vh - 40px);
    padding: 0 20px;
}

/* 用户面板 */
.users-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.user-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.user-header input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

.user-header input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.2);
}

.user-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    font-weight: 500;
}

.user-item:hover {
    background-color: var(--hover-color);
}

.user-item.selected {
    background-color: #e7f3ff;
    color: var(--primary-color);
}

/* 主聊天区域 */
.chat-main {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    z-index: 1;
}

.chat-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

#chat-mode {
    color: var(--text-secondary);
    font-size: 14px;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fff;
}

.load-more {
    text-align: center;
    padding: 10px;
}

.load-more button {
    background: transparent;
    border: none;
    color: var(--primary-color);
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.load-more button:hover {
    background-color: #e7f3ff;
}

/* 消息气泡 */
.message-bubble {
    max-width: 70%;
    margin: 8px 0;
    position: relative;
}

.message-header {
    margin-bottom: 4px;
    font-size: 13px;
}

.message-header .username {
    font-weight: 500;
    color: var(--text-secondary);
}

.message-header .timestamp {
    color: var(--text-secondary);
    margin-left: 8px;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    background: var(--secondary-color);
    font-size: 15px;
    line-height: 1.4;
}

.message-left .message-content {
    background: var(--secondary-color);
    margin-right: auto;
}

.message-right .message-content {
    background: #e7f3ff;
    margin-left: auto;
    color: var(--primary-color);
}

/* 输入区域 */
.input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    position: relative;
    min-height: 80px;
}

#message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    resize: none;
    min-height: 45px;
    max-height: 150px;
    font-size: 15px;
    line-height: 1.4;
    transition: all 0.2s;
    overflow-y: auto;
    word-break: break-word;
    display: block;
    width: 100%;
    scrollbar-width: none;
}

/* 输入框滚动条样式 */
#message-input::-webkit-scrollbar {
    width: 4px;
    display: none;
}

#message-input::-webkit-scrollbar-track {
    background: transparent;
}

#message-input::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

#message-input::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 确保输入框在聚焦时样式正确 */
#message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.1);
}

.send-btn {
    padding: 8px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    height: 40px;
    min-width: 80px;
    white-space: nowrap;
}

.send-btn:hover {
    background: #0073e6;
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 文件面板 */
.file-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.file-panel h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 16px;
}

.file-upload {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-primary);
}

.btn:hover {
    background: var(--hover-color);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#upload-progress {
    margin-top: 8px;
}

.progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: var(--primary-color);
    width: 0;
    transition: width 0.3s;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 16px;
}

.file-item {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    transition: all 0.2s;
}

.file-item:hover {
    background: var(--hover-color);
}

.file-icon {
    font-size: 24px;
    color: var(--primary-color);
}

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .chat-container {
        grid-template-columns: 240px 1fr;
    }
    
    .file-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
        margin: 0;
        height: 100vh;
        padding: 0;
    }
    
    .users-panel {
        display: none;
    }
    
    .chat-main {
        border-radius: 0;
    }
}

/* 私聊页面特定样式 */
.private-chat {
    grid-template-columns: 1fr 300px;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.online-status {
    font-size: 13px;
    color: var(--success-color);
    display: flex;
    align-items: center;
}

.online-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    margin-right: 6px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.header-actions .btn {
    padding: 6px 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* 私聊消息样式 */
.private-chat .message-bubble {
    max-width: 65%;
}

.private-chat .message-right .message-content {
    background: var(--primary-color);
    color: white;
}

.private-chat .message-left .message-content {
    background: var(--secondary-color);
}

/* 私聊文件面板 */
.private-chat .file-panel {
    border-left: 1px solid var(--border-color);
    border-radius: 0 12px 12px 0;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .private-chat {
        grid-template-columns: 1fr;
    }
    
    .private-chat .file-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .private-chat .chat-header {
        padding: 12px 16px;
    }
    
    .private-chat .chat-header h1 {
        font-size: 18px;
    }
    
    .header-actions .btn {
        padding: 4px 8px;
        font-size: 13px;
    }
}

/* 文件消息样式优化 */
.private-chat .file-message {
    display: flex;
    align-items: center;
    gap: 8px;
}

.private-chat .file-message svg {
    flex-shrink: 0;
}

.private-chat .file-message a {
    color: inherit;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.1);
    margin-left: 8px;
    font-size: 13px;
    transition: background-color 0.2s;
}

.private-chat .file-message a:hover {
    background: rgba(0, 0, 0, 0.2);
}

.private-chat .message-right .file-message a {
    background: rgba(255, 255, 255, 0.2);
}

.private-chat .message-right .file-message a:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 添加在线状态指示器样式 */
.online-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--success-color);
    border-radius: 50%;
    margin-left: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    font-weight: 500;
} 